package com.bdqn.service.impl;



import com.bdqn.mapper.StorageMapper;
import com.bdqn.pojo.Storage;
import com.bdqn.pojo.Supplier;
import com.bdqn.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * StorageServiceImpl
 *
 * @aurhor Administrator  whs
 * @since 2024/7/24
 */
@Service("storageService")
public class StorageServiceImpl implements StorageService {

    @Autowired  //@ Resource
    private StorageMapper storageMapper;

    public StorageMapper getStorageMapper() {
        return storageMapper;
    }

    public void setStorageMapper(StorageMapper storageMapper) {
        this.storageMapper = storageMapper;
    }
//    /**
//     * 添加 入库信息
//     *
//     * @param storage
//     * @return
//     */
//    @Override
//    public int addStorage(Storage storage) {
//        return storageMapper.addStorage(storage);
//    }
//
//    /**
//     * 修改 入库信息
//     *
//     * @param storage
//     * @return
//     */
//    @Override
//    public int updStorage(Storage storage) {
//        return storageMapper.updStorage(storage);
//    }
//
//    /**
//     * 删除 入库信息
//     *
//     * @param id
//     * @return
//     */
//    @Override
//    public int delStorage(int id) {
//        return storageMapper.delStorage(id);
//    }


    /**
     * 查询查询入库记录的总记录数
     *
     * @param goodsName  商品名称
     * @param supplierId 供货商ID
     * @param payStatus  支付状态
     * @return
     */
    @Override
    public int count(String goodsName, Integer supplierId, Integer payStatus) {
        return storageMapper.count(goodsName, supplierId, payStatus);
    }

    /**
     * 分页查询查询入库记录
     *
     * @param goodsName  商品名称
     * @param supplierId 供货商ID
     * @param payStatus  支付状态
     * @param pageIndex
     * @param pageSize
     * @return
     */
    @Override
    public List<Storage> selectStoragePageBeginLimitList(String goodsName, Integer supplierId, Integer payStatus, Integer pageIndex, Integer pageSize) {
        return storageMapper.selectStoragePageBeginLimitList(goodsName, supplierId, payStatus, pageIndex, pageSize);
    }


    /**
     * 根据 id查询供货商表
     *
     * @param id
     * @return
     */
    @Override
    public List<Supplier> selectSupplierList(Integer id) {
        return storageMapper.selectSupplierList(id);
    }

    /**
     * 根据 id查询入库记录
     *
     * @param id@return
     */
    @Override
    public Storage selectStoragesById(Integer id) {
        return storageMapper.selectStoragesById(id);
    }

    /**
     * 添加入库记录
     *
     * @param storage
     * @return
     */
    @Override
    public boolean add(Storage storage) {
        return storageMapper.add(storage);
    }

    /**
     * 入库记录修改
     *
     * @param storage
     * @return
     */
    @Override
    public boolean update(Storage storage) {
        return storageMapper.update(storage);
    }


}
